UNLINK

Section: MINTLIB LIBRARY FUNCTIONS (3)
Updated: 3 March 1993
Index Return to Main Contents
 

NAME

unlink - remove directory entry  

SYNOPSIS

#include <unistd.h>

int unlink(char *path);

#include <stdio.h>

int remove(const char *path);
 

DESCRIPTION

unlink removes the directory entry named by the pathname pointed to by path. On file systems that allow hard links, the link count of the file referred to by that entry is decremented by one. If this entry was the last link to the file, the file is removed. If any process has the file open, and the file system supports removal of open files, the actual resource reclamation is delayed until the file is closed, even though the directory entry has disappeared.  

RETURN VALUES

unlink returns:
 0 on success. -1 on failure and sets errno to indicate the error.  

SEE ALSO

close(3), link(3), rmdir(3)  

NOTES

Applications should use rmdir to remove directories. MS-DOS (TOS) filesystems do not support hardlinks. MS-DOS (TOS) filesystems only allow the removal of open files, to be deleted on closing, since MiNT 0.98. The file will still have a directory entry, though. The identical function remove is available for backwards compatibility. Its use is discouraged.
 

Index

NAME
SYNOPSIS
DESCRIPTION
RETURN VALUES
SEE ALSO
NOTES

This document was created by man2html, using the manual pages.
Time: 11:14:48 GMT, June 22, 2025